import { Entity, PrimaryGeneratedColumn, CreateDateColumn, Column, Unique } from 'typeorm';

@Entity()
@Unique(['userId', 'articleId']) // 确保每个用户对每篇文章只能点赞一次
export class Like {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ nullable: true })
  userId: number;

  @Column({ nullable: true })
  articleId: number;

  @CreateDateColumn()
  createdAt: Date;
}